/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package radiostationv4;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author KiKiWi
 */
@Entity
@Table(name = "ARTIST")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Artist.findAll", query = "SELECT a FROM Artist a"),
    @NamedQuery(name = "Artist.findByArtistId", query = "SELECT a FROM Artist a WHERE a.artistId = :artistId"),
    @NamedQuery(name = "Artist.findByArtistFirstName", query = "SELECT a FROM Artist a WHERE a.artistFirstName = :artistFirstName"),
    @NamedQuery(name = "Artist.findByArtistLastName", query = "SELECT a FROM Artist a WHERE a.artistLastName = :artistLastName"),
    @NamedQuery(name = "Artist.findByArtistArtisticName", query = "SELECT a FROM Artist a WHERE a.artistArtisticName = :artistArtisticName"),
    @NamedQuery(name = "Artist.findByArtistSex", query = "SELECT a FROM Artist a WHERE a.artistSex = :artistSex"),
    @NamedQuery(name = "Artist.findByArtistBirthDay", query = "SELECT a FROM Artist a WHERE a.artistBirthDay = :artistBirthDay"),
    @NamedQuery(name = "Artist.findByArtistBirthPlace", query = "SELECT a FROM Artist a WHERE a.artistBirthPlace = :artistBirthPlace")})
public class Artist implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ARTIST_ID")
    private Integer artistId;
    @Basic(optional = false)
    @Column(name = "ARTIST_FIRST_NAME")
    private String artistFirstName;
    @Basic(optional = false)
    @Column(name = "ARTIST_LAST_NAME")
    private String artistLastName;
    @Column(name = "ARTIST_ARTISTIC_NAME")
    private String artistArtisticName;
    @Basic(optional = false)
    @Column(name = "ARTIST_SEX")
    private String artistSex;
    @Column(name = "ARTIST_BIRTH_DAY")
    @Temporal(TemporalType.DATE)
    private Date artistBirthDay;
    @Column(name = "ARTIST_BIRTH_PLACE")
    private String artistBirthPlace;
    @ManyToMany(mappedBy = "artistList")
    private List<MusicGroup> musicGroupList;
    @JoinColumn(name = "MUSIC_GENRE_ID", referencedColumnName = "MUSIC_GENRE_ID")
    @ManyToOne(optional = false)
    private MusicGenre musicGenreId;
    @OneToMany(mappedBy = "artistId")
    private List<Album> albumList;

    public Artist() {
    }

    public Artist(Integer artistId) {
        this.artistId = artistId;
    }

    public Artist(Integer artistId, String artistFirstName, String artistLastName, String artistSex) {
        this.artistId = artistId;
        this.artistFirstName = artistFirstName;
        this.artistLastName = artistLastName;
        this.artistSex = artistSex;
    }

    public Integer getArtistId() {
        return artistId;
    }

    public void setArtistId(Integer artistId) {
        this.artistId = artistId;
    }

    public String getArtistFirstName() {
        return artistFirstName;
    }

    public void setArtistFirstName(String artistFirstName) {
        this.artistFirstName = artistFirstName;
    }

    public String getArtistLastName() {
        return artistLastName;
    }

    public void setArtistLastName(String artistLastName) {
        this.artistLastName = artistLastName;
    }

    public String getArtistArtisticName() {
        return artistArtisticName;
    }

    public void setArtistArtisticName(String artistArtisticName) {
        this.artistArtisticName = artistArtisticName;
    }

    public String getArtistSex() {
        return artistSex;
    }

    public void setArtistSex(String artistSex) {
        this.artistSex = artistSex;
    }

    public Date getArtistBirthDay() {
        return artistBirthDay;
    }

    public void setArtistBirthDay(Date artistBirthDay) {
        this.artistBirthDay = artistBirthDay;
    }

    public String getArtistBirthPlace() {
        return artistBirthPlace;
    }

    public void setArtistBirthPlace(String artistBirthPlace) {
        this.artistBirthPlace = artistBirthPlace;
    }

    @XmlTransient
    public List<MusicGroup> getMusicGroupList() {
        return musicGroupList;
    }

    public void setMusicGroupList(List<MusicGroup> musicGroupList) {
        this.musicGroupList = musicGroupList;
    }

    public MusicGenre getMusicGenreId() {
        return musicGenreId;
    }

    public void setMusicGenreId(MusicGenre musicGenreId) {
        this.musicGenreId = musicGenreId;
    }

    @XmlTransient
    public List<Album> getAlbumList() {
        return albumList;
    }

    public void setAlbumList(List<Album> albumList) {
        this.albumList = albumList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (artistId != null ? artistId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Artist)) {
            return false;
        }
        Artist other = (Artist) object;
        if ((this.artistId == null && other.artistId != null) || (this.artistId != null && !this.artistId.equals(other.artistId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "radiostationv4.Artist[ artistId=" + artistId + " ]";
    }
    
}
